fw4.uc: filter duplicates in fw4.set
authorStijn Tintel <[email protected]>
Thu, 6 Jan 2022 11:12:37 +0000 (13:12 +0200)
committerStijn Tintel <[email protected]>
Thu, 6 Jan 2022 12:48:56 +0000 (14:48 +0200)
Suggested-by: Jo-Philipp Wich <[email protected]>
Signed-off-by: Stijn Tintel <[email protected]>
Reviewed-by: Jo-Philipp Wich <[email protected]>
root/usr/share/ucode/fw4.uc

index c07b35567aaa5157f0302fb4f797c9a533499248..747250963bdf2e6c4dd7755e7bae13e878102084 100644 (file)
@@ -1405,7 +1405,9 @@ return {
        },
 
        set: function(v, force) {
-               v = to_array(v);
+               let seen = {};
+
+               v = filter(to_array(v), item => !seen[item]++);
 
                if (force || length(v) != 1)
                        return sprintf('{ %s }', join(', ', map(v, this.quote)));